package com.hospital.common.core.utils;

import com.hospital.common.core.annotation.DbTypeEnum;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;


/**
 * @author lvyao
 * @description 医院编码静态编码配置
 * @date 2021/8/13
 */
@Component
public  class DataBaseValue {
    public   enum  DbValueEnum {
        db1Vaule("212B1001"), db2Vaule("58697240"),db3Vaule("312B1001"),db4Vaule("79457439"),
        db5Vaule("6XHR7W0R"),db6Vaule("95965247"),db7Vaule("8592154J"),db8Vaule("U36246X2"),db9Vaule("6XJHJA06");
        private String value;

        DbValueEnum(String value) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }
    }

    public static String getDataBaseVaule(String keyValue) {
        Map<String, String> dataBaseMap = new HashMap<>();
        dataBaseMap.put("db1", DbValueEnum.db1Vaule.getValue());
        dataBaseMap.put("db2", DbValueEnum.db2Vaule.getValue());
        dataBaseMap.put("db3", DbValueEnum.db3Vaule.getValue());
        dataBaseMap.put("db4", DbValueEnum.db4Vaule.getValue());
        dataBaseMap.put("db5", DbValueEnum.db5Vaule.getValue());
        dataBaseMap.put("db6", DbValueEnum.db6Vaule.getValue());
        dataBaseMap.put("db7", DbValueEnum.db7Vaule.getValue());
        dataBaseMap.put("db8", DbValueEnum.db8Vaule.getValue());
        dataBaseMap.put("db9", DbValueEnum.db9Vaule.getValue());
        return dataBaseMap.get(keyValue);
    }

    public static DbTypeEnum getDataBase(String keyValue) {
        Map<String,DbTypeEnum> dataBaseMap = new HashMap<>();
        dataBaseMap.put(DbValueEnum.db1Vaule.getValue(),DbTypeEnum.db1);
        dataBaseMap.put(DbValueEnum.db2Vaule.getValue(),DbTypeEnum.db2);
        dataBaseMap.put(DbValueEnum.db3Vaule.getValue(),DbTypeEnum.db3);
        dataBaseMap.put(DbValueEnum.db4Vaule.getValue(),DbTypeEnum.db4);
        dataBaseMap.put(DbValueEnum.db5Vaule.getValue(),DbTypeEnum.db5);
        dataBaseMap.put(DbValueEnum.db6Vaule.getValue(),DbTypeEnum.db6);
        dataBaseMap.put(DbValueEnum.db7Vaule.getValue(),DbTypeEnum.db7);
        dataBaseMap.put(DbValueEnum.db8Vaule.getValue(),DbTypeEnum.db8);
        dataBaseMap.put(DbValueEnum.db9Vaule.getValue(),DbTypeEnum.db9);
        return dataBaseMap.get(keyValue);
    }
    public static String getDataBaseTopic(String keyValue) {
        Map<String,String> dataBaseMap = new HashMap<>();
        dataBaseMap.put(DbValueEnum.db1Vaule.getValue(),"jel-his-orcl-stream");
        dataBaseMap.put(DbValueEnum.db2Vaule.getValue(),"bgy-his-orcl-stream");
        dataBaseMap.put(DbValueEnum.db3Vaule.getValue(),"dfl-his-orcl-stream");
        dataBaseMap.put(DbValueEnum.db4Vaule.getValue(),"rj-his-orcl-stream");
        dataBaseMap.put(DbValueEnum.db5Vaule.getValue(),"cjp-his-orcl-stream");
        dataBaseMap.put(DbValueEnum.db6Vaule.getValue(),"md-his-orcl-stream");
        dataBaseMap.put(DbValueEnum.db7Vaule.getValue(),"gxgk-his-orcl-stream");
        dataBaseMap.put(DbValueEnum.db8Vaule.getValue(),"bt-his-orcl-stream");
        dataBaseMap.put(DbValueEnum.db9Vaule.getValue(),"hj-his-orcl-stream");
        return dataBaseMap.get(keyValue);
    }
}
